<form method="post" enctype="multipart/form-data" id="form-order">
    <table class="table table-bordered table-hover">
        <thead>
        <tr>
            <th>ID</th>
            <th>科目</th>
            <th>试卷名称</th>
            <th>添加人</th>
            <th>添加时间</th>
            <th style="display:none">排序</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="ajaxList">
        {if empty($examList)}
        <tr>
            <td colspan="7" align="center">暂无数据</td>
        </tr>
        {/if}
        {foreach name="$examList" item="v" key="k" }
        <tr role="row">
            <td>{$v.examid}</td>
            <td>{$v.subject_name}</td>
            <td><a>{$v.exam_name|getSubstr=0,33}</a></td>
            <td>{$v.add_name}</td>
            <td>{$v.add_time|date="Y-m-d H:i"}</td>
            <td style="display:none"><input type="text" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onpaste="this.value=this.value.replace(/[^\d]/g,'')" onchange="updateSort('exam','examid','{$v.examid}','exam_order',this)" size="4"  value="{$v.exam_order}" /></td>
            <td>
                <a class="btn btn-primary" href="/index.php/Admin/Exam/examEdit/examid/{$v.examid}" title="编辑"><i class="fa fa-pencil"></i></a>
                <a class="btn btn-danger" href="javascript:void(0)" title="删除" onclick="delarticle(this,'确定删除该试卷？',{$v.examid},'/index.php/Admin/Exam/examHide')"><i class="fa fa-trash-o"></i></a>
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
</form>
<div>
    <div style="float:left;display:none"><a href="javascript:void(0);" onclick="reback_select()" id="button-delete6" data-toggle="tooltip" title="删除" class="btn btn-danger" data-original-title="放入回收站">把选中文章放入回收站</a></div>
    <div style="float:right;margin-top:-20px;" id="pagelist">{$examPage|raw}<span style="float:right;margin:25px">共{$examCount}条</span></div>
</div>
<script>
    // 点击分页触发的事件
        $(".pagination a").click(function(){
            url = $(this).attr('href');
            ajax_get_table('formSearch',url);
            return false;
        });
    // 删除选中
    function reback_select(){
        parent.layer.confirm('确定把选中文章加入回收站？', function(){
            url = window.location.href;
            $.ajax({
                url:"/index.php/Admin/article/reback_select",
                data : $('#form-order').serialize(),
                success: function(v){
                    var v =  eval('('+v+')');
                    parent.layer.msg(v.message, {icon: v.icon,time: 1000});
                    if(v.hasOwnProperty('status') && (v.status == 1))
                        getAjaxList('ajaxList',1,"/index.php/Admin/Article/ajaxArticleList");
                }
            });
        });
    }

    function attrBg(obj){
        if($(obj).prop('checked')){
            $(obj).closest('tr').addClass('active_bg');
        }else{
            $(obj).closest('tr').removeClass('active_bg');
        }
    }
</script>